package nz.net.pole.util;

/**
 * <p>An exception used to indicate that a <code>null</code> pointer was passed to a method in error. Any time an
 * argument is defined that can be null (i.e. the argument is an object) and there is no valid reason for it to be null,
 * then that argument should be tested before it is used. Testing the argument before it is used avoids the possibility
 * of a <code>NullPointerException</code>. If the argument turns out to be null this Exception should be thrown.</p>
 *
 * <p>This does not eliminate the purpose of the <code>NullPointerException</code>, it merely makes it easier to track
 * down an null pointer by allowing the exception handler to print a message stating which argument had the null
 * pointer. This makes debugging more easier for programmers.
 *
 * @author James Pole (james@pole.net.nz)
 */
public class NullArgumentException extends NullPointerException {

    /**
     * Creates a instance with the given argument name. It will automatically generate the exception message
     * "<i>Argument <b>$argumentName</b> was null.</i>".
     * 
     * @param argumentName The name of the argument which was null.
     */
    public NullArgumentException(String argumentName) {

        super("Argument " + argumentName + " was null.");

    }
}
